/**
 * 
 */
package com.fpt.edu.vn.h2tv.dto;

import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;

/**
 * @author niteha
 * 
 */
@XmlRootElement(name = "cart_item")
public class CartItem {

	private Book book;
	private int quanity;
	private CartItemStatus status;

	@Override
	public boolean equals(Object obj) {
		try {
			if (!(obj instanceof CartItem)) {
				return false;
			}
			CartItem cartItem = (CartItem) obj;
	
			if (this.book.equals(cartItem.book)
					&& this.quanity == cartItem.quanity) {
				return true;
			} else {
				return false;
			}
		} catch (NullPointerException e) {
			return false;
		}
	}

	public CartItemStatus getStatus() {
		return status;
	}

	@XmlElement
	public void setStatus(CartItemStatus status) {
		this.status = status;
	}

	public Book getBook() {
		return book;
	}

	@XmlElement
	public void setBook(Book book) {
		this.book = book;
	}

	public int getQuanity() {
		return quanity;
	}

	@XmlElement
	public void setQuanity(int quanity) {
		this.quanity = quanity;
	}
}
